' ***********************************************************************
' Assembly         : Ioc
' Author           : Tim Ford
' Created          : 10-02-2013
'
' Last Modified By : Tim Ford
' Last Modified On : 10-02-2013
' ***********************************************************************
' <copyright file="IocConfiguration.vb" company="Red Baron Solutions">
'     Red Baron Solutions. All rights reserved.
' </copyright>
' <summary></summary>
' ***********************************************************************



Namespace Ioc.Configuration
    ''' <summary>
    ''' This class is actually what loads the custom settings.
    ''' </summary>
    Public Class IocConfiguration
        Inherits System.Configuration.ConfigurationSection
        Private Const ConfigurationSectionName As String = "IocConfiguration"

        ''' <summary>
        ''' Returns an IocConfiguration instance
        ''' </summary>
        Public Shared Function GetConfig() As IocConfiguration

            If TryCast(System.Configuration.ConfigurationManager.GetSection(IocConfiguration.ConfigurationSectionName), IocConfiguration) IsNot Nothing Then
                Return DirectCast(System.Configuration.ConfigurationManager.GetSection(IocConfiguration.ConfigurationSectionName), IocConfiguration)
            Else
                Return New IocConfiguration()
            End If

        End Function
        ''' <summary>
        ''' Gets the settings.	
        ''' </summary>
        ''' <value></value>
        ''' <remarks></remarks>
        <System.Configuration.ConfigurationProperty("Container")> _
        Public ReadOnly Property Container() As IocContainerCollection
            Get
                Return If(DirectCast(Me("Container"), IocContainerCollection), New IocContainerCollection())
            End Get
        End Property
    End Class
End Namespace

